home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2002 November / SGI IRIX Base Documentation 2002 November.iso / usr / share / catman / p_man / cat4 / dir.z / dir
Encoding:
Text File  |  2002-10-03  |  4.2 KB  |  133 lines

  1.  
  2.  
  3.  
  4. DDDDIIIIRRRR((((4444))))                                                                  DDDDIIIIRRRR((((4444))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      dir - format of EFS directories
  10.  
  11. SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  12.      ####iiiinnnncccclllluuuuddddeeee <<<<ssssyyyyssss////ffffssss////eeeeffffssss____ddddiiiirrrr....hhhh>>>>
  13.  
  14. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  15.      A directory behaves exactly like an ordinary file, save that no user may
  16.      write into a directory.  The fact that a file is a directory is indicated
  17.      by a bit in the flag word of its i-node entry [see _i_n_o_d_e(4)].  The EFS
  18.      directory format supports variable length names of up to 255 characters.
  19.  
  20. DDDDIIIIRRRREEEECCCCTTTTOOOORRRRYYYY BBBBLLLLOOOOCCCCKKKKSSSS
  21.      Each EFS directory is segmented into directory blocks defined by the
  22.      following data structure:
  23.  
  24.           #define EFS_DIRBLK_HEADERSIZE 4
  25.           struct  efs_dirblk {
  26.                   /* begin header */
  27.                   ushort      magic;
  28.                   unchar      firstused;
  29.                   unchar      slots;
  30.                   /* end header */
  31.  
  32.                   /* rest is space for efs_dent's */
  33.                   unchar      space[EFS_DIRBSIZE - EFS_DIRBLK_HEADERSIZE];
  34.           };
  35.  
  36.      Each directory block is subdivided into three separate areas: a header,
  37.      an array of entry offsets and an array of directory entries.  The system
  38.      restricts directory entries to short boundaries and stores offsets in the
  39.      directory block compacted by shifting them right by one.
  40.  
  41.      The header area contains a _m_a_g_i_c number to identify the block as being a
  42.      directory block.  If the _m_a_g_i_c number is incorrect, the operating system
  43.      will refuse to manipulate the directory, thus avoiding further
  44.      corruption.
  45.  
  46.      The array of entry offsets immediately follows the header and is sized
  47.      according to the directories contents and contains compacted offsets
  48.      which point to each directory entry.  The number of entry offsets
  49.      available is kept in _s_l_o_t_s.  The _f_i_r_s_t_u_s_e_d field contains a compacted
  50.      offset which positions the first byte of the directory entries.
  51.  
  52.      The space between the end of the entry array and the beginning of the
  53.      directory entries (_f_i_r_s_t_u_s_e_d) is free space which the system uses for
  54.      allocating new directory entries and entry offsets.  The system keeps the
  55.      free space in a directory block compacted by coalescing holes created by
  56.      entry removal.  When a directory entry is removed, the system adjusts the
  57.      entry offsets for all entries that move.  Also, the entry offset for the
  58.      removed entry is zeroed.  If the removed entry was the last in the entry
  59.      offset array, the number of _s_l_o_t_s is reduced.  Directory entries never
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. DDDDIIIIRRRR((((4444))))                                                                  DDDDIIIIRRRR((((4444))))
  71.  
  72.  
  73.  
  74.      change which entry offset they use.
  75.  
  76. DDDDIIIIRRRREEEECCCCTTTTOOOORRRRYYYY EEEENNNNTTTTRRRRIIIIEEEESSSS
  77.      Directory entries have the following structure:
  78.  
  79.           struct  efs_dent {
  80.                   union {
  81.                         ulong l;
  82.                         ushorts[2];
  83.                   } ud_inum;
  84.                   unchar      d_namelen;
  85.                   char  d_name[3];
  86.           };
  87.  
  88.      The _d__n_a_m_e field is actually of variable size, depending upon the value
  89.      contained in _d__n_a_m_e_l_e_n.  The system pads out the directory entry to
  90.      insure that it begins on a short boundary in the directory block.  The
  91.      _u_d__i_n_u_m field contains the entries inode number.
  92.  
  93. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  94.      fs(4), inode(4).
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.